import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Login from '../views/login.vue'
import Personalpage from '../views/PersonalPage/personalpage.vue'
import Personallaunched from '../views/PersonalLaunched/launchedpage.vue'
import Tolaunch from '../views/ToLaunch/tolaunchpage.vue'
import PersonalMsg from '../views/PersonalPage/personalmsg'
import PersonalCollection from '../views/PersonalPage/personalcollection'
import Scholarpage from '../views/scholarborder.vue'
import AuthorPage from '../views/author.vue'
import Search from "../views/Search.vue";
import Literature from '../views/literature.vue'
import Authors from '../views/allauthors.vue'
import High from '../views/highsearch.vue'
Vue.use(VueRouter)

const routes = [{
		path: '/',
		name: 'Home',
		component: Home
	},
	{
		path: '/login',
		name: 'Login',
		component: Login
	},
	{
		path: '/tolaunch',
		name: 'Tolaunch',
		component: Tolaunch
	},
	{
		path: '/personalpage',
		name: 'Personalpage',
		component: Personalpage,
		children: [{
				path: 'personalmsg',
				name: 'Personalmsg',
				component: PersonalMsg
			},
			{
				path: 'personalcollect',
				name: 'Personalcollect',
				component: PersonalCollection
			}
		]
	},
	{
		path: '/personallaunched',
		name: 'Personallaunched',
		component: Personallaunched,
		
	},
	{
		path:'/scholarpage',
		name:'Scholarpage',
		component:Scholarpage,
		children:[]
	},
	{
		path: '/about',
		name: 'About',
		// route level code-splitting
		// this generates a separate chunk (about.[hash].js) for this route
		// which is lazy-loaded when the route is visited.
		component: () => import( /* webpackChunkName: "about" */ '../views/About.vue')
	},
	{
		path: '/author/:id',
		name: 'author',
		component:AuthorPage
	},
	{
		path: '/search/:text',
		name: 'search',
		component:Search
	},
	{
		path:'/literature/:id',
		name:'Literature',
		component:Literature
	},
	{
		path:'/authorres/:text',
		name:'authors',
		component: Authors
	},
	{
		path:'/high-search/:text',
		name:'high-search',
		component:High
	}
]

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
})
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(to) {
	return VueRouterPush.call(this, to).catch(err => err)
}

export default router
